/**
 * File: MaqBfqController.java
 * Created by: mhaimel
 * Created on: 7 Jul 2009
 * CVS:  $Id: MaqBfqController.java,v 1.1 2009/08/05 15:16:12 mhaimel Exp $
 */
package uk.ac.ebi.curtain.controller.maq.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import uk.ac.ebi.curtain.controller.ParallelController;
import uk.ac.ebi.curtain.controller.SimpleReport;
import uk.ac.ebi.curtain.controller.maq.MaqBean;
import uk.ac.ebi.curtain.controller.maq.MaqBfqOutputBean;
import uk.ac.ebi.curtain.management.IControllerReport;
import uk.ac.ebi.curtain.management.InterceptorInfo;
import uk.ac.ebi.curtain.processor.maq.impl.MaqBfqProcessor;

/**
 * @author mhaimel
 *
 */
public class MaqBfqController extends ParallelController<MaqBean, MaqBfqOutputBean, MaqBfqProcessor> {
	private Log log = LogFactory.getLog(this.getClass());
	private int iCnt;

//	@Override
//	public synchronized void handle(MaqBean input, InterceptorInfo info) {
//		for(List<FileInfo> list : input.getReadBfqList()){
//			++iCnt;
//			MaqBean bean = new MaqBean(input);
//			bean.getReadBfqList().clear();
//			bean.getReadBfqList().add(list);
//			MaqBfqProcessor processor = getContext().getInjector().getInstance(MaqBfqProcessor.class);
//			processor.setInput(bean);
//			submit(processor);
//		}
//	}
	
	
	@Override
	protected MaqBfqProcessor buildJob(MaqBean input, InterceptorInfo info) {
//		throw new NotImplementedException("Should not be called - handle overwritten!!!");
		++iCnt;
		return getContext().getInjector().getInstance(MaqBfqProcessor.class);
	}

	@Override
	protected IControllerReport getReturnCall() {
		return new SimpleReport("Finished with submitting: " + iCnt);
	}
}
